#ifndef PQ_H
#define PQ_H


#include "Common_Types.h"

typedef void* (*getpri)(void*);
typedef U8 (*cmppri)(void* next, void* curr);

//PQ structure
typedef struct
{
    U32 currentSize;
    U32 availableSize;
    getpri getPriority;
    cmppri comparePriority;
    void** nodes;
} PQ_STRUCT;

#ifdef __cplusplus
	extern "C" {
	//initialize queue with given size
	PQ_STRUCT * initPQ(U32 n, getpri getPriority, cmppri comparePriority);

	//free allocated memory for the PQ
	void freeUpPQ(PQ_STRUCT *q);

	//return size
	U32 getSizePQ(PQ_STRUCT* q);

	//insert a new element (node) to the PQ (q) returns 1 if fails
	STATUS insertNodePQ(PQ_STRUCT* q, void* node);

	//pop-out the uppermost element in the PQ
	void* popPQ(PQ_STRUCT* q);

	//access the uppermost element in the PQ
	void* peekPQ(PQ_STRUCT* q);
	}
#endif
#endif
